package SV_WEAK_CRYPT;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.UUID;

public class Vulnerable_01 {
    public static UUID nameUUIDFromBytes (byte[] name) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            return makeUuid(md.digest(name), 3);
        } catch (NoSuchAlgorithmException e) {
            throw new AssertionError(e);
        }
    }

    private static UUID makeUuid(byte[] digest, int i) {
        return UUID.nameUUIDFromBytes(digest);
    }

}
